package org.extreme.pivot;

import org.apache.pivot.wtk.Action;
import org.extreme.model.sheet.XSheet;
import org.extreme.pivot.grid.XSheetPane;

public class DesignerActions {
	XDesigner xDesigner;
    
	public DesignerActions(XDesigner xDesigner) {
		this.xDesigner = xDesigner;
	}
	
	public void init() {
		initFileMenuActions();

        initEditMenuActions();
	}
	
	private void initFileMenuActions() {
		Action.getNamedActions().put("fileNew", new Action() {
            @Override
            public void perform() {
            	XSheet xSheet = new XSheet();
                xSheet.getReportWidthHeightManager().setRowHeight(0, 50);
                xSheet.getReportWidthHeightManager().setColWidth(1, 90);
                
                xDesigner.tabPane.getTabs().add(new XSheetPane(xSheet));
                fileSaveAction.setEnabled(true);
            }
        });

        Action.getNamedActions().put("fileOpen", new Action() {
            @Override
            public void perform() {
            	
            }
        });

        Action.getNamedActions().put("fileSave", this.fileSaveAction);
	}
	
	private void initEditMenuActions() {
		Action.getNamedActions().put("cut", new Action(false) {
            @Override
            public void perform() {
            }
        });
		
		Action.getNamedActions().put("copy", new Action(false) {
            @Override
            public void perform() {
            	// TODO
            }
        });

        Action.getNamedActions().put("paste", new Action(false) {
            @Override
            public void perform() {
            	// TODO
            }
        });
	}

	private Action fileSaveAction = new Action(false) {
    	
        @Override
        public void perform() {
        	// TODO
        }
    };
}
